package com.soft.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.soft.entity.Orderlist;
import com.soft.entity.Orderlistdetails;
import com.soft.mapper.OrderlistdetailsMapper;


@Service
public class OrderlistdetailsService {
	@Autowired
	private OrderlistdetailsMapper orderlistdetailsMapper;
	
    public List<Orderlistdetails> queryByorderlistId(Long orderlistId){
		QueryWrapper<Orderlistdetails> qw = new QueryWrapper<>();
		qw.eq("orderlist_id", orderlistId);
		List<Orderlistdetails> orderlistdetailsList = orderlistdetailsMapper.selectList(qw);
		return orderlistdetailsList;
	}
    public int insertOne(Long orderlistId,String foodName,Long foodCount,Long foodPrice,Long detailsAllprice) {
    	Orderlistdetails orderlistdetails = new Orderlistdetails();
    	orderlistdetails.setOrderlistId(orderlistId);
    	orderlistdetails.setFoodName(foodName);
    	orderlistdetails.setFoodCount(foodCount);
    	orderlistdetails.setFoodPrice(foodPrice);
    	orderlistdetails.setDetailsAllprice(detailsAllprice);
    	return orderlistdetailsMapper.insert(orderlistdetails);
    }
	
}
